﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bll;
using Model;


namespace Myproject.BSM.PcWeb.PcChannel.Article
{
    public partial class NewsEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string newsID = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(newsID))
            {
                NewsModel model = new NewsBLL().GetModel(int.Parse(newsID));
                pc_Channel_NewsEdit_ID.Value = model.NewsId.ToString();
                pc_Channel_NewsEdit_title.Value = model.Title;
                pc_Channel_NewsEdit_subtitle.Value = model.ETitle;
                pc_Channel_NewsEdit_etitle.Value = model.ETitle;
                pc_Channel_NewsEdit_esubtitle.Value=model.ESubTitle;
                pc_Channel_NewsEdit_channelname.Value = new ArticleBLL().GetModel(int.Parse(model.WebChannelId.ToString())).ChanneTitle;
                pc_Channel_NewsEdit_channelID.Value = model.WebChannelId.ToString();
                pc_Channel_NewsEdit_show.Checked = model.show;
                pc_Channel_NewsEdit_showtime.Value = model.ShowTime.ToString("yyyy-MM-dd HH:mm:ss");
                pc_Channel_NewsEdit_url.Value = model.Url;
                pc_Channel_NewsEdit_Source.Value = model.Source;
                pc_Channel_NewsEdit_Editor.Value = model.Editor;
                pc_Channel_NewsEdit_ReadTmes.Value = model.ReadTmes.ToString();
                txtArticleContent.Value = model.WebContent;
                txtArticleContent2.Value = model.EWebContent;
            }
            else
            {
                string channelID = Request.QueryString["cid"];
                if (!string.IsNullOrEmpty(channelID))
                {
                    pc_Channel_NewsEdit_channelname.Value = new ArticleBLL().GetModel(int.Parse(channelID)).ChanneTitle;
                    pc_Channel_NewsEdit_channelID.Value = channelID;
                }

                pc_Channel_NewsEdit_showtime.Value =DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
        }
    }
}